#ifndef THREAD__H
#define THREAD__H

#include <pthread.h>
#include <iostream>
#include <unistd.h>
#include "Mutex.h"

class Thread {
public:
	Thread();
	virtual void start();
	virtual void stop();
	virtual void join();
	virtual void run()=0;
	void cancel();
	virtual ~Thread();
	bool isRunning();
	virtual void sleepThread(unsigned int seconds);
	void setMorir(bool morir);
	bool getMorir();
	Mutex & getMutex();
private:
	bool running;
	pthread_t t;
	static void* callback(void* o) {
		((Thread*) o)->run();
		return 0;
	}
//	Thread(const Thread &c);
protected:
	Mutex * mutex;
	bool morir;
};

#endif

